import { createRouter, createWebHistory } from 'vue-router'
import Home from "@/views/Home.vue";
import activity from "@/views/activity/index.vue"
import department from "@/views/department/index.vue"
import index from "@/views/index/index.vue"
import location from "@/views/location/index.vue"
import role from "@/views/role/index.vue"
import user from "@/views/user/index.vue"
import permission from "@/views/permission/index.vue"




const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path:'/',redirect:'/Home'},
    {path:'/Home',name:Home,component:Home,children:[
          {path:'activity',name:activity,component:activity},
          {path:'location',name:location,component:location},
          {path:'department',name:department,component:department},
          {path:'role',name:role,component:role},
          {path:'user',name:user,component:user},
          {path:'index',name:index,component:index},
          {path:'permission',name:permission,component:permission}
      ]}
  ],
})
// 添加一个响应式属性 currentRouter
import { ref } from 'vue';
import home from "@/views/Home.vue";
router.currentRouter = ref('/'); // 初始化为根路径

// 监听路由变化，更新 currentRouter 的值
router.afterEach((to) => {
  router.currentRouter.value = to.path;
});

export default router

